<%@page import="multiface.promonet.jpa.Lavoro"%>
<%@page import="multiface.promonet.jpa.Report"%>
<%@page import="java.math.BigDecimal"%>
<%@page import="multiface.promonet.jpa.RigaProdottoReport"%>
<link rel="stylesheet" href="../../engine/css/style.css" type="text/css" media="screen" />
<script src="../../engine/js/jquery.js" type="text/javascript" ></script>


<%@page import="java.util.List"%>
<%@page import="multiface.promonet.jpa.Prodotto"%>
<%@page import="javax.persistence.EntityManager"%>
<%@page import="multiface.promonet.jpa.util.PersistenceManager"%>
<%@page import="javax.persistence.EntityManagerFactory"%>
<%
    EntityManagerFactory emf = PersistenceManager.getInstance().getEntityManagerFactory();
    EntityManager em = emf.createEntityManager();

    Lavoro l = em.find(Lavoro.class, Integer.parseInt(request.getParameter("lavoroid")));

    em.close();
%>
<style>
    input{
        font-size: 13px;
        padding: 5px;
    }
    table,td{
        margin:6px;
        font-size: 13px;
    }

    .title-product{
        font-size: 15px;
        margin: 6px;
        background-color: #00A551;
        color: white;
        font-weight: bold;
        padding: 5px;
    }
    .loader{
        margin-top: 100px;
    }
</style>

<script>
    function send(){
        var arr ={
            action:'add_report_row',
            section:'job',
            number : parent. $(".center-table-tr").length +1,
            prezzo : $("#prezzo").val(),
            stock :  $("#stock").val(),
            venduti : $("#venduti").val(),
            reportid : <%=request.getParameter("reportid")%>,
            lavoroid: <%=request.getParameter("lavoroid")%>,
            prodottoid :<%=request.getParameter("prodottoid")%>
        };
        
        var loader_img = "<img class=\"loader\" src=\"../../engine/img/loading3.gif\"></img><div>Caricamento in corso..</div>";
        $("#center").html(loader_img);
        
        $.post('../../ActionServlet',arr,function (rigaid_new){
            $.extend(arr, {rigaid: jQuery.trim(rigaid_new)});
            $.post('../popup/adding-tr.jsp',arr,function (data2){
                parent.$("#center-table").append(data2);
                parent.$.fancybox.close();
            });
        });
    }
</script>
<div id="center">
    <div class="title-product"></div>
    <form>
        <table>
            <tr>
                <td>Prezzo</td>
                <td><input type="text" id="prezzo" value=""/> &euro;</td>
            </tr>
            <tr>
                <td>Stock</td>
                <td><input type="text" id="stock" value="" /> pz</td>
            </tr>
            <tr>
                <td>Venduti</td>
                <td><input type="text" id="venduti" value=""/> pz</td>
            </tr>
            <tr>
                <td></td>
                <td><input type="button" onclick="javascript:send();" value="Invia" /></td>
            </tr>
        </table>
    </form>
</div>